#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<set>
using namespace std;
typedef long long ll;
const  ll  N = 1e10 + 10;
ll INF = N;
int main()
{
	set<ll> mp;	mp.insert(INF);mp.insert(-INF);
	int ans = 0,n;cin >> n;
	for (int i = 1; i <= n; i++)
	{
		ll x, y;cin >> x >> y;
		if (x == 1)
		{
			if (mp.count(y)) cout << "Already Exist" << endl;
			else mp.insert(y);
		}
		else
		{
			if (mp.size() == 2) cout << "Empty" << endl;
			else
			{
				auto t = mp.lower_bound(y);
				auto tmp = t;
				tmp--;
				if (abs(*t - y) >= abs(*tmp - y))
				{
					ans = *tmp;
				}
				else ans = *t;
				cout << ans << endl;
				mp.erase(ans);
			}
		}
	}
	return 0;
}